<?php
/**
 * +----------------------------------------------------------------------
 * | Author: 罗极
 * +----------------------------------------------------------------------
 * | Description: Config.php
 * +----------------------------------------------------------------------
 * | User: Administrator Date: 8/20/ 0020 Time: 17:37
 * +----------------------------------------------------------------------
 */

namespace Framework\Config;

class Config
{
    protected static $self;
    protected $confs;


    /**
     * @return  \Framework\Config\Config;
     */
    public static function getInstance() : Config
    {
        if(!is_object(self::$self)) {
            self::$self = new self();
        }
        return self::$self;
    }

    protected function __construct()
    {

    }

    protected function __clone()
    {

    }


    public function set(string $key, $val)
    {
        $this->confs[$key] = $val;
    }


    public function get(string $key)
    {
        return $this->confs[$key];
    }


    public function batchSet(array $confs)
    {
        foreach($confs as $key => $val) {
            $this->confs[$key] = $val;
        }
        unset($confs);
    }

}